#include "Frm08.h"

Frm08::Frm08(HmiApp* app, STTWidget *par, const string& id, const string& desc) : STTPage(app->getRuntime(), par, id, desc) {
	hmiApp = app;
}

Frm08::~Frm08() {
}

void Frm08::onInit() {

}

void Frm08::createParts() {
	setMainArg(0, 0, 1024, 600);
	setMainStyle(0, 0xfffff, 0xffffff, 0, 255, 0, 0xc0c0c0);

	/*----------------------------- Button : wMButton1                   -----------------------------*/
	wMButton1 = new STTButton(p_rt, this, "wMButton1", 0);
	wMButton1->setMainArg(307, 7, 126, 61, false);
	wMButton1->setPressedArg("飞入", 0x0, "文泉驿微米黑", 16, 0);
	wMButton1->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton1->setReleasedArg("飞入", 0x0, "文泉驿微米黑", 16, 0);
	wMButton1->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton1->onEventHandler(Event::CLICKED, this, (EHandler) & Frm08::wMButton1_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch1                 -----------------------------*/
	wMMSwitch1 = new STTButton(p_rt, this, "wMMSwitch1", 2);
	wMMSwitch1->setMainArg(567, 124, 82, 80, false);
	wMMSwitch1->setImg("1", "./images/button_10-1_82X80.gray.svg", "");
	wMMSwitch1->setImg("0", "./images/button_10-0_82X80.svg", "");

	/*----------------------------- EventTable : wMEventTable1           -----------------------------*/
	wMEventTable1 = new STTTable(p_rt, this, "wMEventTable1");
	wMEventTable1->setMainArg(0, 315, 1024, 168, "LID,序号,80;LTIME,时间,80;EID,事件ID,80;ENME,事件名,80;CLSS,分类,80;WLVL,等级,80;UNME,用户,80;ACTN,动作,80;MEMO,说明,80;EXT1,持续时长,80;EXT2,确认时间,79", 7, false, 2);
	wMEventTable1->setHeadCellStyle(0xf0f0f0, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMEventTable1->setSelCellStyle(0x1a2b3, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMEventTable1->setDataCellStyle(0xffffff, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMEventTable1->setDataSourceOfEvent("", "", false, 0, 99, 15, false);

	/*----------------------------- Button : wMButton2                   -----------------------------*/
	wMButton2 = new STTButton(p_rt, this, "wMButton2", 0);
	wMButton2->setMainArg(1, 1, 98, 48, false);
	wMButton2->setPressedArg("返回主页", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton2->setReleasedArg("返回主页", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton2->bindOpenFormHandler(Event::CLICKED, "Frm03", PageMode::NEWWIN, NULL);

	/*called after widget created.*/

	return; //createParts END
}
//飞入
static void valuecb(void* obj, int32_t v) {
	Frm08* widget = (Frm08*)obj;
	widget->setX(v);
}

void Frm08::onLoad() {

}

bool Frm08::onClosing() {
	return true;
}

void Frm08::onDispose() {

}

void Frm08::wMButton1_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton1（功能键）的点击事件*/
	this->getStyle()->p_anim->doAnim(this,-Util::getScrSize().w,0,1000,valuecb,NULL,1);
}
